home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
151-175
/
scopedisk171
/
pfiler
/
pfilerdemo.asm
< prev
next >
Wrap
Assembly Source File
|
1995-03-19
|
2KB
|
95 lines
; OPT O+
; OPT O1+ ;Tells when a branch could be optimised to short
; OPT i+ ;Tells when '#' is probably missing
incdir "INCLUDE:"
include "exec/exec_lib.i"
include "libraries/dosextens.i"
incdir "DF0:PFiler/"
include "PFiler.i"
XREF _FileSelect
XREF _FreeFileSelect
* A few macro's
LoadBase MACRO
IFNC '\1','ExecBase'
movea.l \1(PC),A6
ENDC
IFC '\1','ExecBase'
movea.l 4.W,A6
ENDC
ENDM
CallLib MACRO
jsr _LVO\1(A6)
ENDM
Call MACRO
bsr \1
ENDM
Push MACRO
movem.l \1,-(SP)
ENDM
Pop MACRO
movem.l (SP)+,\1
ENDM
SECTION DEMOCODE,CODE
* Here is a example of how to use FileSelect and FreeFileSelect
Start LoadBase ExecBase
suba.l A1,A1
CallLib FindTask ;Find us
movea.l D0,A2
tst.l pr_CLI(A2)
bne.S CLIAndWBStartup
WBenchStartup lea pr_MsgPort(A2),A0
CallLib WaitPort ;wait for a message
lea pr_MsgPort(A2),A0
CallLib GetMsg
move.l D0,WBenchMsg ;save it for later reply
CLIAndWBStartup
Loop pea FSReq(PC)
move.w #FSF_NOINFO,FSReq+4
jsr _FileSelect ;FileSelect(&FSReq);
addq.l #4,SP
tst.l D0
bne.S Loop
pea FSReq(PC)
jsr _FreeFileSelect ;FreeFileSelect(&FSReq);
addq.l #4,SP
move.l WBenchMsg(PC),D0
beq.S ExitDemo
CallLib Forbid
movea.l D0,A1
CallLib ReplyMsg ;Reply WBenchMessage if we are started from WB
ExitDemo moveq #0,D0
rts
PCHARS =100
FCHARS =33
*This is a FileSelectRequest-structure
FSReq dc.w 130 ;FR_LeftEdge
dc.w 50 ;FR_TopEdge
dc.w 0 ;FR_Flags
dc.w PCHARS ;FR_PathChars
dc.w FCHARS ;FR_FileChars
dc.l PathBuff ;FR_PathBuf
dc.l FileBuff ;FR_FileBuf
dc.l TitleTxt ;FR_TitleTxt
dc.l LoadTxt ;FR_PosTxt
dc.l ExitTxt ;FR_NegTxt
dc.l 0 ;FR_Screen
dcb.b 20,0
WBenchMsg dc.l 0
LoadTxt dc.b ' Try it',0
ExitTxt dc.b ' Exit',0
TitleTxt dc.b 'Click the Menu-button.',0
EVEN
SECTION BUFFERBSS,BSS
PathBuff ds.b PCHARS
FileBuff ds.b FCHARS
END